package com.example.stream.kafka.in;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.core.env.Environment;

/**
 *@Deacription TODO
 *@Author baohuajie
 *@Date 2020/12/10 17:11
 *@Version 1.0
 **/
@EnableBinding(DoMsgInput.class)
public class PushMsgConsumer {
    private final Logger logger = LoggerFactory.getLogger(PushMsgConsumer.class);
    @Autowired
    private DoMsgInput doMsgInput;
    @Autowired
    private Environment environment;

    @StreamListener("pushMsgInput")
    public void handler(String msg) throws InterruptedException {
//        logger.info("端口" + environment.getProperty("server.port") + "休眠开始");
//        Thread.sleep(30000);
        logger.info("端口" + environment.getProperty("server.port") + "休眠结束");
//        logger.info("端口" + environment.getProperty("server.port") + "消费消息" + msg);
    }
}
